(function(clazz,id){
	var grid;
	var classdat = Get("/clazz/name/"+clazz).obj;
	var columns = _("entity.fun.getColumns")(classdat.fields,classdat.query); 
	var callback = function(clazz,pid){
		var data = _("entity.fun.getData")(clazz);
		Ext.getCmp(pid).getRootNode().removeAll();
		Ext.getCmp(pid).getRootNode().appendChild(_("entity.fun.gridtotree")(data));
	}
	
	columns.push({
		xtype: 'actioncolumn',
        text:"修改",  flex:1,
        items: [{
        	icon: "lib/ext/shared/icons/fam/grid.png",
            tooltip: "修改",
            handler: function(grid, rowIndex, colIndex) {
            	_("entity.add.panel")(clazz,id,callback,grid.store.getAt(rowIndex).data);
            }
        }] 
	});
	
	columns.push({
		xtype: 'actioncolumn',
		text:"删除",  flex:1,
        items: [{
        	icon: "lib/ext/shared/icons/fam/delete.gif",
            tooltip: "删除",
            handler: function(grid, rowIndex, colIndex) {
            	_("entity.delete.onepanel")(clazz,id,callback,grid.store.getAt(rowIndex).data);
            }
        }] 
	});
	
	
	grid = {
		xtype		:	'treepanel',
		rootVisible	: false,  //隐藏根节点
        id			:   id,
        selModel	:	Ext.create('Ext.selection.CheckboxModel'),
        columns 	:	columns,
        listeners   : {
        	show:function(){
        		//alert("sdf");
        		callback(clazz,id);
        	}
        } 
	};
	grid["tbar"]	=	_("entity.fun.getTbar")(clazz,id,callback);
	//grid["store"]	=	_("entity.fun.getStore")(clazz,1);
	
	return grid;
})